<template>
	<view>
		<view>
			<uni-nav-bar shadow left-icon="left" dark title="绩效升降级详细" @clickLeft="back()"/>
		</view>
		
		<view>
			<uni-card>
				<uni-row><text style="font-weight: 600;">编码:</text>{{from.code}}</uni-row>
				<uni-row><text style="font-weight: 600;">编号:</text>{{from.number}}</uni-row>
				<uni-row><text style="font-weight: 600;">考评周期:</text>{{from.scoreCycle}}</uni-row>
	            <uni-row><text style="font-weight: 600;">供应商名称:</text>{{from.supplierName}}</uni-row>
	            <uni-row><text style="font-weight: 600;">采购:</text>{{from.procurePerson}}</uni-row>
				<uni-row><text style="font-weight: 600;">技术:</text>{{from.technologyPersonName}}</uni-row>
                 <uni-row><text style="font-weight: 600;">品质:</text>{{from.qualityPersonName}}</uni-row>
				<uni-row><text style="font-weight: 600;">方案类型:</text>{{from.schemeType}}</uni-row>
				<uni-row><text style="font-weight: 600;">总分:</text>{{from.totalScore}}</uni-row>
				<uni-row><text style="font-weight: 600;">计划时间:</text>{{from.initiationTime}}</uni-row>
				<uni-row><text style="font-weight: 600;">考评日期:</text>{{from.dateStart}}至{{from.dateOver}}</uni-row>
<!-- 				<uni-row v-if="from.status==1"><text style="font-weight: 600;">评分状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">评分中</text></uni-row>
				<uni-row v-if="from.status==0"><text style="font-weight: 600;">评分状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">已评分</text></uni-row>
				<uni-row v-if="from.examineStatus==0"><text style="font-weight: 600;">审核状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">待审核</text></uni-row>
				<uni-row v-if="from.examineStatus==1"><text style="font-weight: 600;">审核状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">已通过</text></uni-row>
				<uni-row v-if="from.examineStatus==2"><text style="font-weight: 600;">审核状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">未通过</text></uni-row> -->
			    <uni-row><text style="font-weight: 600;">审核意见:</text><uni-easyinput type="textarea" v-model="SupplierScoreForm.scoreDesc"></uni-easyinput></uni-row>
			<uni-row style="text-align: center;margin-top: 15rpx;">
				<uni-col :span="12"><button size="mini" type="primary" @click="submitHandler()">审核</button></uni-col>
				<uni-col :span="12"><button size="mini" type="warn" @click="goback()">驳回</button></uni-col>
			</uni-row>
			<view>
				<uni-segmented-control :current="current" :values="items" styleType="button" activeColor="#ffaa00" @clickItem="onClickItem" style="background-color: #fff"  />
			</view>
			
			
			<view>
				<view v-if="current === 0">
					<view>
						<uni-table border stripe >
							<uni-tr style="white-space: nowrap;text-align: center;font-size: 12rpx;">
								<uni-th align="center">编号</uni-th>
								<uni-th align="center">编码</uni-th>
								<uni-th align="center">项目名称</uni-th>
								<uni-th align="center">得分</uni-th>
								<uni-th align="center">权重%</uni-th>
								<uni-th align="center">最低分值</uni-th>
								<uni-th align="center">最高分值</uni-th>
								<uni-th align="center">反馈说明</uni-th>
							</uni-tr>
							<uni-tr v-for="(item,index) in table" :key="index" style="white-space: nowrap;text-align: center;font-size: 12rpx">
								<uni-td align="center">{{item.code}}</uni-td>
								<uni-td align="center">{{item.number}}</uni-td>
								<uni-td align="center">{{item.projectName}}</uni-td>
								<uni-td align="center">{{item.score}}</uni-td>
								<uni-td align="center">{{item.weight}}</uni-td>
								<uni-td align="center">{{item.lowScore}}</uni-td>
								<uni-td align="center">{{item.highScore}}</uni-td>
								<uni-td align="center">{{item.feedback}}</uni-td>
							</uni-tr>
						</uni-table>
					</view>
				</view>
				
			</view>
			
			
			
			</uni-card>
		</view>
	</view>
</template>

<script>
	import {SurScoreFormRowId,examineRowId} from "@/api/system/user"
	export default {
		data() {
			return {
			current:0,
			table:null,
			items: ['评分详细'],
			SupplierScoreForm:{
				scoreDesc:null,
				examineStatus:null,
				},
			}
		},
		onLoad() {
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('acceptDataFromOpenerPage', (data) => {
			  this.from = data.data
			  this.get()
			})
		},
		methods: {
			submitHandler(){
				if(this.SupplierScoreForm.scoreDesc==null||this.SupplierScoreForm.scoreDesc==''){
					alert("请填写审核意见")
					return
				}
				
				this.SupplierScoreForm.examineStatus=1	
				this.SupplierScoreForm.supplierId=this.from.supplierId
				this.SupplierScoreForm.totalScore=this.from.totalScore
				examineRowId(this.from.rowId,this.SupplierScoreForm).then(res=>{
				this.$tab.reLaunch('/pages/work/purchaser/performance_management')
				})
			},
			goback(){
				
				if(this.SupplierScoreForm.scoreDesc==null||this.SupplierScoreForm.scoreDesc==''){
					alert("请填写审核意见")
					return
				}
				this.SupplierScoreForm.examineStatus=2
				this.SupplierScoreForm.supplierId=this.from.supplierId
				this.SupplierScoreForm.totalScore=this.from.totalScore
				examineRowId(this.from.rowId,this.SupplierScoreForm).then(res=>{
				this.$tab.reLaunch('/pages/work/purchaser/performance_management')
				})
			},
			
			get(){
				SurScoreFormRowId(this.from.rowId).then(res=>{
					this.table=res.rows
				})
			},
			back(){
					this.$tab.reLaunch('/pages/work/purchaser/performance_management')
			},
			onClickItem(e) {
						if (this.current !== e.currentIndex) {
							this.current = e.currentIndex
						}
					},
		}
	}
</script>

<style>

</style>
